<?php
$url =$_GET['r'];

//解决图片不带http头的问题
if(preg_match("/http/i", $url) == 0){
	$url = 'http:'.$url;
}

$curl = curl_init();
// $header[] = "X-Requested-With: XMLHttpRequest";
curl_setopt_array($curl, array(
  CURLOPT_URL => $url,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  // CURLOPT_CUSTOMREQUEST => "GET",
));
// $data = array('id'=>34,'page'=>1 );
// curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求
// curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的数据包
// curl_setopt($curl, CURLOPT_HTTPHEADER, $header);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);


// $arr['data'] = json_decode($response,true);
// $arr['code'] = 1;

header('Content-type: image/jpg');
echo $response;


?>
